/*
 * @Author: Zeratul
 * @Date: 2020-08-19 17:33:01
 * @LastEditTime: 2020-08-21 17:08:07
 * @FilePath: \sz-h5-2003-react-mobile\zhangminhui\eleme-react\eleme-user\src\Routes\index.js
 */
import React from "react";
import { BrowserRouter as Router, Route,} from "react-router-dom";
import HomePage from "../pages/HomePage";
import { Switch } from "react-router-dom/cjs/react-router-dom.min";
import LoginPage from "../pages/LoginPage";
import UserPage from "../pages/UserPage";
import _404Page from "../pages/_404Page";
import RegistPage from "../pages/RegistPage";
import CartPage from "../pages/CartPage";
import AddressPage from "../pages/AddressPage/address";
import AddAddressPage from "../pages/AddressPage/addAddress";
import UpdateAddressPage from "../pages/AddressPage/updateAddress";
import Map from "../pages/AddressPage/map"
import DiscoverPage from "../pages/DiscoverPage";
import OrderPage from "../pages/OrderPage";
import BottomNav from "../components/BottomNav";
import FoodStore from "../pages/FoodStore";
import FoodOrder from "../components/foodStore/FoodOrder"
import Comment from "../components/foodStore/Comment"
import Merchant from "../components/foodStore/Merchant"

// 配置路由
export default function Routs(props) {
  return (
    <Router>
      <Switch>
        <Route path="/" exact render={()=><BottomNav><HomePage/></BottomNav>}></Route>
        <Route path="/discover" render={()=><BottomNav><DiscoverPage/></BottomNav>}></Route>
        <Route path="/order" render={()=><BottomNav><OrderPage/></BottomNav>}></Route>
        <Route path="/user" render={()=><BottomNav><UserPage/></BottomNav>}></Route>
        <Route path="/login" render={()=><LoginPage/>}></Route>
        <Route path="/regist" render={()=><RegistPage/>}></Route>
        {/* 点击店铺跳转时，传递一个店铺id */}
        <Route exact path="/foodStore/:storeId" render={()=><FoodStore><FoodOrder></FoodOrder></FoodStore>}></Route>
        <Route exact path="/foodStore/comment/:storeId" render={()=><FoodStore><Comment></Comment></FoodStore>}></Route>
        <Route exact path="/foodStore/merchant/:storeId" render={()=><FoodStore><Merchant></Merchant></FoodStore>}></Route>
        <Route path="/cart" render={()=><CartPage/>}></Route>
        <Route path="/address" render={()=><AddressPage/>}></Route>
        <Route path="/addAddress" render={()=><AddAddressPage/>}></Route>
        <Route path="/updateAddress" render={()=><UpdateAddressPage/>}></Route>
        <Route path="/map" render={()=><Map/>}></Route>

        <Route component={_404Page}/>
      </Switch>
    </Router>
  );
}
